<template>
    <div class="flexbetween">
        <div class="inputMain">
            <el-form ref="form" :model="form" label-width="120px">
                <el-row :gutter="10">
                    <el-col :span="8" v-if="type=='common'||type=='else'">
                        <el-form-item label="下单时间">
                            <el-date-picker
                                v-model="value"
                                type="daterange"
                                size="small"
                                range-separator="-"
                                start-placeholder="开始日期"
                                end-placeholder="结束日期"
                                :clearable="false">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" v-if="type=='common'">
                        <el-form-item label="支付状态">
                            <el-select size="small" v-model="form.orderState" placeholder="支付状态">
                                <el-option label="待支付" value="0"></el-option>
                                <el-option label="已支付" value="1"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <!-- <el-col :span="8" v-if="type=='account'">
                        <el-form-item label="账单时间">
                            <el-date-picker
                                v-model="form.name"
                                type="date"
                                size="small">
                            </el-date-picker>
                        </el-form-item>
                    </el-col> -->
                    <!-- <el-col :span="8" v-if="type=='common'||type=='else'">
                        <el-form-item label="订购产品">
                            <el-select size="small" v-model="form.region" placeholder="审批状态">
                                <el-option label="电子签名服务（官网企业）" value="电子签名服务（官网企业）"></el-option>
                                <el-option label="出证服务（e签宝证据报告-纸质版）" value="出证服务（e签宝证据报告-纸质版）"></el-option>
                                <el-option label="电子签名活动套餐（企）" value="电子签名活动套餐（企）"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col> -->
                    <!-- <el-col :span="8" v-if="type=='account'">
                        <el-form-item label="产品名称">
                            <el-select size="small" v-model="form.region" placeholder="签署流量费（组合）">
                                <el-option label="签署流量费（组合）" value="签署流量费（组合）"></el-option>
                                <el-option label="签署流量费（组合）" value="签署流量费（组合）"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col> -->
                    <!-- <el-col :span="8" v-if="type=='common'||type=='else'">
                        <el-form-item label="订单状态">
                            <el-select size="small" v-model="form.region" placeholder="审批状态">
                                <el-option label="电子签名服务（官网企业）" value="电子签名服务（官网企业）"></el-option>
                                <el-option label="出证服务（e签宝证据报告-纸质版）" value="出证服务（e签宝证据报告-纸质版）"></el-option>
                                <el-option label="电子签名活动套餐（企）" value="电子签名活动套餐（企）"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col> -->
                    <!-- <el-col :span="8" v-if="type=='account'">
                        <el-form-item label="订单编号">
                            <el-select size="small" v-model="form.region" placeholder="请选择">
                                <el-option label="G202304211135283669" value="G202304211135283669"></el-option>
                                <el-option label="G202304211135283669" value="G202304211135283669"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col> -->
                </el-row>

                <el-row>
                    <!-- <el-col :span="8" v-if="type=='common'">
                        <el-form-item label="特殊订单类型">
                            <el-select size="small" v-model="form.region" placeholder="审批状态">
                                <el-option label="电子签名服务（官网企业）" value="电子签名服务（官网企业）"></el-option>
                                <el-option label="出证服务（e签宝证据报告-纸质版）" value="出证服务（e签宝证据报告-纸质版）"></el-option>
                                <el-option label="电子签名活动套餐（企）" value="电子签名活动套餐（企）"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col> -->
                    <!-- <el-col :span="8" v-if="type=='common'">
                        <el-form-item label="支付状态">
                            <el-select size="small" v-model="form.orderState" placeholder="支付状态">
                                <el-option label="待支付" value="0"></el-option>
                                <el-option label="已支付" value="1"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col> -->
                </el-row>


            </el-form>
        </div>
        <div class="btnMain">
            <el-button size="small" type="primary" @click="search">查询</el-button>
            <el-button size="small" @click="reset">重置</el-button>
        </div>
    </div>
</template>

<script>
export default {
    props:['type'],
    data() {
        return {
            form: {
                // name: '',
                orderState:'',//支付状态 0 待支付 1 已支付
                insertEndTime:'',// 结束时间
                insertStartTime:'',//开始时间
            },
            show:false,
            value:[],
        }
    },
    watch:{
        'value'(){
            // console.log(Number(this.value[0]));
            // console.log(this.value[0]);
            if(this.value=='[]'){
                this.form.insertStartTime=''
                this.form.insertEndTime=''
            }else{
                this.form.insertStartTime=this.date(Number(this.value[0]))
                this.form.insertEndTime=this.date(Number(this.value[1]))
            }
            
        },
    },
    methods: {
        date(timer) {
			var date = new Date(timer); //当前时间
			var year = date.getFullYear() //返回指定日期的年份
			var month = repair(date.getMonth() + 1); //月
			var day = repair(date.getDate()); //日
			var curTime = year + "-" + month + "-" + day
			function repair(i) {
				if (i >= 0 && i <= 9) {
					return "0" + i;
				} else {
					return i;
				}
			}
			return curTime
		},
        search() {
            this.$emit("Listsearch", this.form)
        },
        reset() {
            for (var key in this.form) {
                this.form[key] = "";
            }
            this.value=[]
            this.$emit("Listsearch", this.form)
        },
        changeShow(type){
            if(type==1){
                this.show=false
            }else if(type==2){
                this.show=true
            }
        }
    }
}
</script>

<style lang="scss">
.inputMain{
    .el-select {
        width: 100%;
    }
    .el-select .el-input{
        width: 100%;
    }
    .el-date-editor--daterange.el-input__inner{
        width: 100%;
    }
    .el-form-item{
        margin-bottom: 16px;
    }
    .el-button--mini{
        padding:5px 7px;
    }
}
</style>

<style lang="scss" scoped>
.inputMain{
    width:70%;
}
.btnMain{
    margin-right: 30px;
    align-self: flex-start;
    .active{
        transform: rotate(90deg);
        padding-left: 9px;
        padding-right: 9px;
    }
}
</style>